package com.zh.boot05web01.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: zhanghuan
 * @date: 2022/9/15 21:15
 * @description: create it
 */
@Controller
public class HelloController {

    @RequestMapping("/")
    public String index() {
        return "index";
    }

    @ResponseBody
    @RequestMapping(value = "/user", method = RequestMethod.GET)
    public String getUser() {

        return "GET-zhangsan";
    }

    @ResponseBody
//    @RequestMapping(value = "/user", method = RequestMethod.POST)
    @PostMapping("/user")
    public String saveUser() {
        return "POST-zhangsan";
    }

    @ResponseBody
    @RequestMapping(value = "/user", method = RequestMethod.PUT)
    public String putUser() {
        return "PUT-zhangsan";
    }

    @ResponseBody
//    @RequestMapping(value = "/user", method = RequestMethod.DELETE)
    @DeleteMapping("/user")
    public String deleteUser() {
        return "DELETE-zhangsan";
    }
}
